home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Macromedia Multimedia Showcase 5.1
/
Macromedia - Multimedia Showcase 5.1 (Macromedia) (1996).ISO
/
pc
/
media
/
shared.dir
/
02002_Script_navigation object
< prev
next >
Wrap
Text File
|
1996-03-28
|
33KB
|
1,015 lines
-- Nav Object
property sceneID, returnSceneID, navlist, nextlink, menulink, fileName, history,activeBtns, activeLinks, btnInstanceList, curEvent, eventQue, exitQue, mediaList, running, savedTimer, firstBtnSprite, lastBtnSprite,totalLinkSprites, btnOutlineSprite, QTMSprite,timingOut, timeoutDelay, timeoutStartTicks, newDelay, endDelay, returnFrame, returnTime, direction, playIcon, prevCursCast, handCursCast, myClickedSprite, firstNavSprite, pauseSprite, linkY, videoCounter, matchTime,firstLinkSprite, lastLinkSprite, currentSound, musicCastName, fadingOut, musicKilled, pauseBtnCast, pausedStartTicks, musicPlaying, scrollingTextObj, scrollBarSprite, topMaskSprite, bottomMaskSprite, volumeSprite,activeLocators, firstLocatorSprite, MainMenuNum, MainMenuLoc, popUpChannel,FinderObj, flashNextTime, unflashNextTime, nextSprite
on birth me
set QTMSprite = 21 -- QuickTime movies always in sprite 21...
set savedTimer = 0 -- keeps track of timer when you pause playback in mid-sequence
set running = true -- run mode or paused mode property
set newDelay = TRUE
set endDelay = 0
set eventQue = [ ]
set exitQue = [ ]
set navlist = [:]
global gRecompileLists
if gRecompileLists then
set navlinks = the text of cast "dbase*navigation"
repeat with i = 1 to the number of lines of navlinks
set myLine = line i of navlinks
set myScene = value("#" & item 1 of myLine)
addProp navlist, myScene, item 2 to 6 of myLine
end repeat
put navlist into field "Compiled*Navigation*List"
else
set navlist = value(the text of field "Compiled*Navigation*List")
end if
set history = [:]
set returnFrame = 0
set returnTime = 0
set returnSceneID = #none
set mediaList = [#B:"DrawBtn",#L:"DrawBtn",#K:"KillLink",#S:"HandleScript",#M:"HandleMarker"]
set btnInstanceList = [:] -- a list that contains the instances of the 'link event object'
set activeBtns = [ ] -- a list that contains currently active buttons
set activeLinks = [ ]
set MainMenuNum = 15000
set MainMenuLoc = "loc" & mainMenuNum
set activeLocators = [ MainMenuLoc ]
set prevCursCast = the number of cast "curs PREV"
set handCursCast = the number of cast "curs HAND"
set pauseBtnCast = the number of cast "btn*pause"
set playIcon = 0
set scrollBarSprite = 14
set topMaskSprite = 16
set bottomMaskSprite = 17
set volumeSprite = 26
set firstLocatorSprite = 27
set firstNavSprite = 23
set pauseSprite = 24
set nextSprite = 25
set firstBtnSprite = 30
set lastBtnSprite = 41
set firstLinkSprite = 42
set lastLinkSprite = 44
set totalLinkSprites = lastLinkSprite - firstLinkSprite + 1
set popUpChannel = 45
set btnOutlineSprite = 46 -- outlined buttons, lines when clicked
set myClickedSprite = 0
set linkY = 464 -- fixed vertical location of links on screen
set direction = #none
InitPuppets(me)
set musicKilled = FALSE
set musicPlaying = FALSE
set scrollingTextObj = ""
set FinderObj = ""
set flashNextTime = 0
set unflashNextTime = 0
return me
end birth
on InitPuppets me
set menuSprite = firstNavSprite+4 -- was + 3
puppetSprite menuSprite, true -- menu button
set the cursor of sprite menuSprite to [handCursCast,handCursCast+1]
puppetSprite pauseSprite, true -- pause/play btn
puppetSprite volumeSprite, TRUE
set the castNum of sprite volumeSprite = the number of cast ("volume" & the soundLevel)
repeat with i = firstLocatorSprite to (firstLocatorSprite + 2)
puppetSprite i, TRUE
end repeat
repeat with i = firstBtnSprite to lastBtnSprite
set the cursor of sprite i to [handCursCast,handCursCast+1]
end repeat
repeat with i = firstLinkSprite to lastLinkSprite
puppetsprite i, true -- declare button sprites as puppets
set the cursor of sprite i to [handCursCast,handCursCast+1]
end repeat
puppetSprite btnOutlineSprite, TRUE
repeat with i = firstNavSprite to firstNavSprite + 3
set the cursor of sprite i to [handCursCast, handCursCast+1]
end repeat
puppetTempo 120
set the keyDownScript = "HandleKeyPress"
end InitPuppets
on PrevSeq me
if not(fadingOut) then
set myLast = count(history)
if myLast>1 then
if returnFrame = 0 then
set jumpPoint = getPropAt(history,myLast-1)
set myReturnList = getAt(history,myLast-1)
set myReturnFrame = getAt(myReturnList,1)
set myReturnTime = getAt(myReturnList,2)
deleteAt(history,myLast)
-- put "prev:" && jumpPoint
else -- returnFrame <> 0, so just jump to beginning of same scene
set jumpPoint = getPropAt(history,myLast)
end if
set direction = #prev
LoadSeq me, jumpPoint -- pre-emptive load of sequence info
set returnFrame = myReturnFrame
set returnTime = myReturnTime
ChangeScene me, jumpPoint
end if
end if
end PrevSeq
on NextSeq me
if not(fadingOut) then
if (timingOut and not(TimeOutExpired(me))) then
set timingOut = FALSE
go the frame+1 -- end of scene: show scene exit sequence
else
set jumpPoint = nextlink
set jumpSceneNum = value(jumpPoint)
if integerP(jumpSceneNum) and (jumpSceneNum > 0) then
LoadSeq me, jumpPoint -- pre-emptive load of sequence info
ChangeScene me, jumpPoint
else
doHandlerEvent(me, jumpPoint)
end if
end if
end if
end NextSeq
on MenuSeq me
if not(fadingOut) then
set jumpPoint = menulink
set direction = #jump
LoadSeq me, jumpPoint -- pre-emptive load of sequence info
ChangeScene me, jumpPoint
end if
end MenuSeq
on HelpSeq me
if not(fadingOut) then
set jumpPoint = "82000" -- AUT: hardwired Help starting screen
set direction = #jump
StoreReturn me
LoadSeq me, jumpPoint
ChangeScene me, jumpPoint
end if
end HelpSeq
on MarkReturn me
set returnFrame = the frame
set returnTime = the timer
end MarkReturn
on StoreReturn me
set returnSceneID = sceneID
end StoreReturn
on ReturnFromSequence me
set jumpPoint = returnSceneID
set returnSceneID = #none
LoadSeq me, jumpPoint
ChangeScene me, jumpPoint
end ReturnFromSequence
on StartTimeOut me
set timeoutStartTicks = the ticks
set flashNextTime = the ticks + 60
set unflashNextTime = 0
end StartTimeOut
on TimeOutExpired me
-- checks status of time out at end of scene
if timingOut then -- timeout sequence in progress
checkNextFlash(me)
if (the ticks - timeoutStartTicks) > timeoutDelay then
return TRUE
end if
else
return FALSE
end if
end TimeOutExpired
on Delay me, duration
global gMode
if gMode = #Demo then
pass
return 0
end if
-- delay in a frame script
if newDelay then
set newDelay = FALSE
set endDelay = the ticks + duration*60
end if
if the ticks <= endDelay then
UpdateEvents(me)
UpdateRollover(me)
set tempScene = value(sceneID)
if tempScene < 70000 or tempScene > 80000 then
checkNextFlash(me)
end if
go the frame
else
set newDelay = TRUE
end if
end Delay
on checkNextFlash me
if not (flashNextTime or unflashNextTime) then
set flashNextTime = the ticks + 30
return
end if
if flashNextTime and (the ticks > flashNextTime) then
puppetsprite nextSprite,TRUE
set the castNum of sprite nextSprite = the number of cast "next Hilite"
set flashNextTime = 0
set unflashNextTime = the ticks + 30
else
if unflashNextTime and (the ticks > unflashNextTime) then
puppetsprite nextSprite,FALSE
set flashNextTime = the ticks + 120
set unflashNextTime = 0
end if
end if
end checkNextFlash
on PauseAnim me, theValue
-- put #PauseAnim && theValue
set movieCast = the castNum of sprite QTMSprite
set running = theValue
if running then -- resume playback
cursor 0
set the timer = savedTimer -- restore to saved value of the timer
set the castNum of sprite pauseSprite = pauseBtnCast
if musicKilled then
set musicKilled = FALSE
PlaySceneMusic me
end if
-- ResetNavTimeout() -- reset the timeout delay
if not(movieCast=0) then
set the movieRate of sprite QTMSprite = 1
end if
else -- pause playback
if not(fadingOut) then
set savedTimer = the timer -- store current value of the timer
set pausedStartTicks = the ticks
set the castNum of sprite pauseSprite = pauseBtnCast+1
cursor 0
if movieCast=0 then -- no QTM sound running
if musicPlaying then
puppetsound 0
set musicKilled = TRUE
set musicPlaying = FALSE
end if
else
set the movieRate of sprite QTMSprite = 0
end if
repeat while true
if the mouseDown then
pass
end if
UpdateCursors me
updateStage
-- go the frame
end repeat
end if
end if
end PauseAnim
-- need to dynamically check and set cursors while in "PAUSE" mode
-- because of the tight repeat loop in PauseAnim()
on UpdateCursors me
-- update pause/play cast (display hilited or not)
global gMode
if gMode = #Presentation then checkMainMenuButton
if ((the ticks - pausedStartTicks)>60) then
set the castNum of sprite pauseSprite = pauseBtnCast+1+playIcon
set playIcon = (playIcon+1) mod 2
set pausedStartTicks = the ticks
end if
set the locH of sprite btnOutlineSprite = -800
repeat with i = firstNavSprite to firstNavSprite + 3
-- prev nav, play/pause, forward nav, Volume control
if rollover(i) then
Hilite(me, i)
cursor [handCursCast,handCursCast+1]
return 0
end if
end repeat
repeat with i = firstLocatorSprite to (firstLocatorSprite + count(activeLocators))
if rollover(i) then
if not (i = (firstLocatorSprite + 2) and ((sceneID > 80000) or inVision(sceneID))) then
Hilite(me, i)
cursor [handCursCast,handCursCast+1]
end if
return 0
end if
end repeat
set btnCount = count(activeBtns)
set lastActiveBtn = firstBtnSprite+btnCount-1
repeat with i = firstBtnSprite to lastActiveBtn -- was -3
if rollover(i) then
Hilite(me, i)
cursor [handCursCast,handCursCast+1]
return 0
end if
end repeat
set linkCount = count(activeLinks)
set lastActiveLink = firstLinkSprite+linkCount-1
repeat with i = firstLinkSprite to lastActiveLink
-- put #linksRollover && firstLinkSprite && lastActiveLink
if rollover(i) then
Hilite(me, i)
cursor [handCursCast,handCursCast+1]
return 0
-- set the cursor of sprite i to [handCursCast,handCursCast+1]
end if
end repeat
cursor 0
end UpdateCursors
on SeqExists me, whichLink
if whichLink = empty then
return FALSE
else
if voidP(integer(whichLink)) then
return FALSE
else
return TRUE
end if
end if
end SeqExists
-- pre-emptive load of info for the scene which we are about to jump to
-- sets custom switches prior to jumping to the new sequence
-- #NOTE: the value of 'mySequence' is the destination scene ID, which
-- is different from the current scene ID, stored in 'sceneID'
on LoadSeq me, mySequence
cursor 4
puppetTransition 0
set mySequence = value(mySequence)
-- BtnOutlineStart me -- NH 10/8 enabled again only to colorize btn outlines on user input
addProp history, mySequence, [0,0] -- add goto point to history
set myLast = count(history)
if myLast>1 then
if mySequence = getPropAt(history,myLast-1) then
-- put mySequence "already in history"
deleteAt(history,myLast)
end if
end if
if not(voidP(getAProp(history, value(sceneID)))) then
setProp history, value(sceneID), [returnFrame,returnTime] -- mark frame,time exited
-- put "mark RTS:" && returnFrame
end if
set returnFrame = 0
set returnTime = 0
HandleExitQue(me)
getProp(navlist,mySequence)
set myLinks = the result
set nextlink = item 1 of myLinks
set menulink = item 2 of myLinks
global K -- timeout delay multiplier
set timeoutDelay = integer(item 3 of myLinks)*60*K
global gFileSuffix
set fileName = item 4 of myLinks & gFileSuffix
set musicCastName = item 5 of myLinks
global gEventList -- load eventQue
getAProp(gEventList, mySequence)
set myResult = the result
if voidP(myResult) then
set eventQue = [ ]
else
set eventQue = value(string(myResult)) -- note: a copy of the list
end if
end LoadSeq
on ChangeScene me, whichFrame
cursor 4
set timingOut = FALSE
set sceneID = whichFrame -- sceneID is current scene's frame label
set jumpCommand = "go"
if returnFrame = 0 then
set jumpCommand = jumpCommand && quote & string(sceneID) & quote
else
set jumpCommand = jumpCommand && "frame" && returnFrame
-- AUT: delete unneeded items from eventQue here!
end if
set thisMovieName = the movieName
if not(fileName = thisMovieName) then
PlaySceneMusic me
set jumpCommand = jumpCommand && "of movie" && quote & fileName & quote
AuditBtns(me, whichFrame)
if the result = #Abort then exit
ResetQTM(me)
-- MAKE SURE VOLUME SPRITE STAYS UPDATED!
set volCast = the number of cast "VolumeCast"
set curVolLevelCast = the castnum of sprite volumeSprite
setNewPict(volcast, curVolLevelCast, volumeSprite)
Do jumpCommand -- make the jump to the new sequence
InitPuppets(me)
else
UpdateBtnsDisplay(me)
AuditBtns(me, whichFrame)
if the result = #Abort then exit
ResetQTM(me)
BtnOutlineEnd me
Do jumpCommand -- make the jump to the new sequence
end if
set newDelay = TRUE
set endDelay = 0
set flashNextTime = 0
set unflashNextTime = 0
puppetSprite nextSprite,FALSE
set direction = #none
UpdateBtnsDisplay(me)
UpdateLocatorBtns(me)
PauseAnim me, true
startTimer -- start media synchronization timer
set the timer = returnTime
set videoCounter = 10000*(integer(returnTime/10000))
end ChangeScene
on WaitForQTM me
set myCast = the castNum of sprite QTMSprite
if myCast=0 then
return FALSE
else
set myLength = the duration of cast myCast
if the movieTime of sprite QTMSprite < myLength then
return TRUE
else -- QTM running, but movie is done
return FALSE
end if
end if
end WaitForQTM
on ResetQTM me
set the visible of sprite QTMSprite = FALSE
updateStage
set the visible of sprite QTMSprite = TRUE
end ResetQTM
-- handle 00000 events and all those with tBirthPtr < returnTime
on AuditBtns me, mySequence
set activeBtns = [ ]
set activeLinks = [ ]
global tBirthPtr
repeat while count(eventQue)>0 -- at least 1 event in this scene
LoadNextEvent(me)
if returnTime>=matchTime then
global castIdPtr
set aChar = char 1 of item castIdPtr of curEvent
if aChar <> "M" then
set linkType = value("#" & aChar)
getProp(mediaList, linkType)
Do (the result && "me," && quote & curEvent & quote & ", #AuditBtns")
-- the result is name of a handler; the matched 'mediaList' value
if the result = #Abort then
return #Abort
else deleteAt(eventQue,1)
else
deleteAt(eventQue,1)
end if
else
exit repeat
end if
end repeat
return 1
end AuditBtns
on HandleExitQue me
repeat while count(exitQue)>0
getAt(exitQue, 1)
set curEvent = the result
Do (curEvent)
deleteAt(exitQue,1)
end repeat
end HandleExitQue
-- check event que and update media sequencer, screen, etc
on UpdateEvents me
if count(eventQue)>0 then -- at least 1 event in this scene
if the timer >= matchTime then
-- set whereIAm = the movie
global castIdPtr
set linkType = value("#" & char 1 of item castIdPtr of curEvent)
getProp(mediaList, linkType)
-- the result is name of a handler; the matched 'mediaList' value
Do (the result && "me," && quote & curEvent & quote & ", #UpdateEvents")
if the result <> #Abort then
deleteAt(eventQue,1)
end if
LoadNextEvent(me)
end if
end if
end UpdateEvents
on LoadNextEvent me
if count(eventQue)>0 then
global tBirthPtr
-- put eventQue
getAt(eventQue, 1)
set curEvent = the result
set matchTime = integer(item tBirthPtr of curEvent)
else
set curEvent = #done
end if
end LoadNextEvent
on DrawBtn me, whatEvent, caller
-- put "AssignBtn / DrawBtn" && whatEvent
global castIdPtr
set castID = item castIdPtr of whatEvent
-- test to see if this link's instance already exists
getaProp btnInstanceList, value("#" & castID)
set myInstance = the result
if voidP(myInstance) then
set myInstance = birth(script "button object", whatEvent)
addProp btnInstanceList, value("#" & castID), myInstance
else
Assign(myInstance, whatEvent)
end if
-- update the display
if castID contains "L" then
add activeLinks, castID
if caller = #UpdateEvents then -- caller can also be #AuditBtns
UpdateBtnsDisplay(me)
end if
else -- "B" type of button
add activeBtns, castID -- add button to active button list
end if
end DrawBtn
on KillLink me, whatEvent
global castIdPtr
set castID = item castIdPtr of whatEvent
put "L" into char 1 of castID
getPos activeLinks, castID
deleteAt activeLinks, the result
UpdateBtnsDisplay(me) -- update the links on the screen
end KillLink
on HandleMarker me, whatEvent
-- deal with a marker within a sequence (media transition)
go marker(1)
end HandleMarker
on HandleScript me, theEvent, caller
global scriptPtr
set myHandler = item scriptPtr of theEvent
if the number of words of myHandler > 1 then
set paramList =""
repeat with parameter = 2 to the number of words of myHandler
put "," & QUOTE & word parameter of myHandler & QUOTE after paramList
end repeat
do (word 1 of myHandler && "me" & paramList & ", #" & caller)
else
do(myHandler && "me, #" & caller)
end if
end HandleScript
on DeleteFromHistory me
Add exitQue, "deleteFromNav me"
end DeleteFromHistory
on AlwaysDeleteFromHistory me
Add exitQue, "deleteFromNav(me, #Always)"
end AlwaysDeleteFromHist
on deleteFromNav me, when
if direction = #none or when = #Always then
set myLast = count(history)
deleteAt(history,myLast-1)
end if
end deleteFromNav
on UpdateBtnsDisplay me
set leftMargin = 385
set linksAlive = count(activeLinks)
repeat with i = 1 to linksAlive
getAt activeLinks, i
set castID = the result
set currentSprite = firstLinkSprite-1+i
set the castNum of sprite currentSprite = cast castID
set the rect of sprite currentSprite = the rect of cast castID
set currentWidth = the width of cast castID
set the locH of sprite currentSprite = leftMargin+(currentWidth/2)
set the locV of sprite currentSprite = linkY
set leftMargin = leftMargin + currentWidth
end repeat
repeat with i = linksAlive+1 to totalLinkSprites+1
set currentSprite = firstLinkSprite-1+i
set the locH of sprite currentSprite = -400
end repeat
end UpdateBtnsDisplay
on UpdateLocatorBtns me
global gLocatorList, activeLocators
set sceneString = string(sceneID)
set val = value(sceneString)
if val > 80000 and val < 95000 then
set activeLocators = getEndLocators(val)
else
if (inVision(val)) then
if val >= 95000 then
set activeLocators = [ MainMenuLoc, "loc95000" ]
else
set activeLocators = [ MainMenuLoc, "loc29000" ]
end if
else
set activeLocators = [ MainMenuLoc ]
sort gLocatorList
set MainMenuList = getAt(gLocatorList, 1)
set closeLoc = findPosNear(gLocatorList, sceneString)
set LocFound = getPropAt(gLocatorList, closeLoc)
set LocInMainMenu = integerP(getAProp(MainMenuList,sceneString))
if LocFound = sceneString or LocInMainMenu then
-- going to scene with a level 1 locator
if (closeLoc > 1) or LocInMainMenu then -- don't add 'Main Menu' to list again.
append(activeLocators, ("loc" & sceneString))
end if
else
if LocFound > sceneString and closeLoc > 2 then
set closeLoc = closeLoc - 1
set LocFound = getPropAt(gLocatorList, closeLoc)
end if
if LocFound <= sceneString and closeLoc > 1 then
append(activeLocators, ("loc" & LocFound))
set Level2List = getProp(gLocatorList,LocFound)
set LocFound2 = 0
repeat with i = 1 to count(Level2List)
set thisOne = getPropAt(Level2List, i)
if thisOne > LocFound2 and thisOne <= sceneString then
set LocFound2 = thisOne
end if
end repeat
if LocFound2 > 0 and LocFound2 <= sceneString then
append(activeLocators,("loc" & LocFound2))
end if
end if
end if
end if
end if
set tempLocList = value(string(activeLocators)) -- copy of list
set val = value(sceneString)
if val >= 77200 and val < 80000 then setAt (tempLocList, 3, "loc77200") --???
if (val < 80000) and not (inVision(val)) then -- or val >= 95000
append(tempLocList, "LocEmpty")
end if
append(tempLocList, "LocBlack")
repeat with i = 1 to 3
set nextCast = getAt(tempLocList, i)
set nextCastNum = the number of cast nextCast
set the castNum of sprite (firstLocatorSprite + i - 1) to nextCastNum
end repeat
updateStage
end UpdateLocatorBtns
-- click on a generic button (message sent by score script):
on ClickBtn me
if not(fadingOut) then
set mySprite = the clickOn
set myClickedSprite = mySprite
set myCastID = the castNum of sprite mySprite
set myCastID = the name of cast myCastID
set lastLocatorSprite = firstLocatorSprite + 2
if (mySprite >= volumeSprite) and (mySprite <= lastLocatorSprite) then
-- clicked on volume, or locator sprite
ClickLocator(me, mySprite, myCastID)
else
getaProp btnInstanceList, value("#" & myCastID)
set myInstance = the result
set locOrScript = the jumpToID of myInstance
if locOrScript contains "#Instant" then
set mouseMe = TRUE
else
set mouseMe = waitForMouseUp(mySprite)
end if
if mouseMe then
if seqExists(me, the jumptoID of myInstance) then
set direction = #jump
GoToLink(myInstance) -- regular jump to sceneID kind of button
else
set myScript = the jumpToID of myInstance
doHandlerEvent(me, myScript)
end if
end if
end if
end if
end ClickBtn
on doHandlerEvent me, myScript
if the number of words of myScript > 1 then
set theParams = ""
repeat with param = 2 to the number of words of myScript
if param > 2 then put ", " after theParams
put QUOTE & word param of myScript & QUOTE after theParams
end repeat
do (word 1 of myScript && theParams)
else
do myScript
end if
end doHandlerEvent
on ClickLocator me, whichSprite, whichCastName
if whichSprite = firstLocatorSprite then
set gotMe = waitForMouseUp(whichSprite)
if gotMe then
JumpSequence(15000) -- AUT: hardwired jump to main menu
end if
else
set whichLocator = ""
set locatorNum = 0
if whichCastName starts "volume" then set whichLocator = "Volume"
if whichCastName starts "loc" and not (whichCastName = "LocBlack") then
set whichLocPos = (whichSprite - firstLocatorSprite + 1)
set whichPopUp = getAt(activeLocators, whichLocPos-1)
set letterCount = the number of chars of whichPopUp
set locatorNum = char 4 to lettercount of whichPopUp
set whichLocator = locatorNum
end if
if whichLocator <> "" then
btnOutlineStart(me)
global gLocatorList
set sizeLocList = count(getProp(gLocatorList,whichLocator))
set thePopUpCast = the number of cast ("Pop" & whichLocator)
set thePopUpH = the locH of sprite whichSprite
set thePopUpV = the top of sprite whichSprite - ((the height of cast thePopUpCast) / 2)
set PopUpPt = point(thePopUpH, thePopUpV)
set thePopUpSelect = doPopUp(me, thePopUpCast, PopUpPt, sizeLocList, whichCastName)
if thePopUpSelect = 0 then
if locatorNum <> 0 then
set newSceneLocChars = the number of chars of whichCastName
set newSceneName = char 4 to newSceneLocChars of whichCastName
set newScene = value(newSceneName)
if newScene > 0 and newScene <> sceneID then
LoadSeq me, newScene
ChangeScene me, newScene
else
toggleQT(QTMSprite, 1)
end if
end if
else
if thePopUpSelect > 0 then
set LocList = getProp(gLocatorList, whichLocator)
set sceneOrScript = getOne(LocList, thePopUpSelect)
-- put "sceneOrScript = ", sceneOrScript
if seqExists(me, sceneOrScript) then
if value(sceneOrScript) <> sceneID then
set direction = #jump
LoadSeq(me, sceneOrScript)
ChangeScene(me, sceneOrScript)
else
toggleQT(QTMSprite, 1)
end if
else
set myScript = sceneOrScript
doHandlerEvent(me, myScript)
toggleQT(QTMSprite, 1)
end if
else
toggleQT(QTMSprite, 1)
end if
end if
end if
end if
end clickLocator
on DoPopUp me, aCast, aPoint, numDivisions, clickedCastName
set PopUpSprite = popupChannel
set clickSprite = the clickOn
set PopUpHeight = the height of cast aCast - 2
set itemHeight = (float(PopUpHeight) / numDivisions)
set entryTicks = the ticks
set aCastName = the name of cast aCast
if ((aCastName contains "volume") or (clickedCastName = "LocEmpty")) then
set updateTicks = entryTicks
else set updateTicks = entryTicks -- + 10
set didUpdate = FALSE
puppetsprite PopUpSprite, TRUE
set the castNum of sprite PopUpSprite = aCast
set the loc of sprite PopUpSprite = aPoint
set movieCast = the castNum of sprite QTMSprite
if not(movieCast=0) then
set popUpWide = the width of cast aCast / 2
set popUpHigh = the height of cast aCast / 2
set x = getAt(aPoint,1)
set y = getAt(aPoint,2)
set rect1 = rect(x-popUpWide, y - popUpHigh, x+popUpWide, y+popUpHigh)
set rect2 = rect(the left of sprite QTMSprite, the top of sprite QTMSprite, the right of sprite QTMSprite, the bottom of sprite QTMSprite)
if intersect(rect1, rect2) <> rect(0,0,0,0) then
set the movieRate of sprite QTMSprite = 0
end if
end if
set the stretch of sprite PopUpSprite = FALSE
repeat while the mouseDown
if not didUpdate then
if the ticks > updateTicks then
updateStage
set didUpdate = TRUE
exit repeat
end if
end if
end repeat
if not didUpdate then
set the locH of sprite PopUpSprite = -1000
puppetsprite PopUpSprite,FALSE
end if
set lastItem = 0
set popUpTop = the top of sprite PopUpSprite
repeat while the mouseDown
if rollover(PopUpSprite) then
set theItemNum = integer(((the mouseV - PopUpTop) / itemHeight) -.5)
if (theItemNum >= 0) and (theItemNum < numDivisions) then
set itemTop = PopUpTop + ((theItemNum) * itemHeight)
set itemLeft = the left of sprite PopUpSprite
set itemRight = the right of sprite PopUpSprite
HiliteRect (me, itemLeft, itemRight, itemTop, itemTop + itemHeight +4)
updateStage
set lastItem = theItemNum + 1
end if
else
if rollover(clickSprite) then
hilite(me, clickSprite)
else
unHilite(me)
end if
updateStage
set lastItem = -1
end if
end repeat
set the foreColor of sprite btnOutlineSprite = 0
set the locH of sprite PopUpSprite = -1000
puppetSprite PopUpSprite, FALSE
UnHilite(me)
updateStage
if rollover(clickSprite) then return 0
else return lastItem
end DoPopUp
on BtnOutlineStart me
set the foreColor of sprite btnOutlineSprite = 248
end BtnOutlineStart
on BtnOutlineEnd me
set the locH of sprite btnOutlineSprite = -800
set the foreColor of sprite btnOutlineSprite = 0
set direction = #none
end BtnOutlineEnd
on PlaySceneMusic me
global gMusicOn
if gMusicOn then
if not(currentSound = musicCastName and musicPlaying) then
set myCast = the castNum of sprite QTMSprite
if not(myCast=0) then
set the movieRate of sprite QTMsprite = 0
sound close 1
end if
set currentSound = musicCastName
set musicPlaying = TRUE
puppetSound currentSound
updatestage
end if
end if
end PlaySceneMusic
-- Fade out sound -- Prep for QuickTime
on StartMusicFadeOut me
sound fadeout, 1, 60
set timeoutStartTicks = the ticks
end StartMusicFadeOut
on MusicFadeOutDone me
if musicPlaying then
if (the ticks - timeoutStartTicks) > 65 then
puppetsound 0
set fadingOut = FALSE
set musicPlaying = FALSE
return TRUE
end if
else
set fadingOut = FALSE
return TRUE
end if
end MusicFadeOutDone
on StartQTMEvent me
set myCast = the castNum of sprite QTMSprite
set the movieRate of sprite QTMSprite = 1
set videoCounter = videoCounter+10000
set the timer = videoCounter
end StartQTMEvent
-- dynamic custom cursor and sprite hilite allocation for all touch areas
-- checks for active buttons and links on the screen
-- constantly re-adjusts the range of sprites that are 'hot'
-- (minimizes which sprites are being tested at any given time)
on UpdateRollover me
global gMode
if gMode = #Presentation then checkMainMenuButton
-- set custom cursors for all active buttons and links on screen,
-- including the help and menu btns
set the locH of sprite btnOutlineSprite = -800
set btnCount = count(activeBtns)
set lastActiveBtn = firstBtnSprite+btnCount-1
repeat with i = firstNavSprite to (firstNavSprite + 3)
-- previous navigation, play/pause, forward navigation, Volume control
if rollover(i) then
Hilite(me, i)
return 0
end if
end repeat
repeat with i = firstLocatorSprite to (firstLocatorSprite + count(activeLocators))
if rollover(i) then
if not (i = (firstLocatorSprite + 2) and ((sceneID > 80000) or inVision(sceneID))) then
Hilite(me, i)
cursor [handCursCast,handCursCast+1]
end if
return 0
end if
end repeat
repeat with i = firstBtnSprite to lastActiveBtn -- was firstBtnSprite - 3
if rollover(i) then
Hilite(me, i)
return 0
end if
end repeat
set linkCount = count(activeLinks)
set lastActiveLink = firstLinkSprite+linkCount-1
repeat with i = firstLinkSprite to lastActiveLink
if rollover(i) then
Hilite(me, i)
return 0
end if
end repeat
cursor 0
end UpdateRollover
on Hilite me, theSprite
puppetTransition 0
spriteBox btnOutlineSprite, the left of sprite theSprite, ¼
the top of sprite theSprite, the right of sprite theSprite, the bottom of sprite theSprite
end Hilite
on HiliteRect me, theLeft, theRight, theTop, theBottom
puppetTransition 0
spriteBox btnOutlineSprite, theLeft, theTop, theRight, theBottom
end HiliteRect
on UnHilite me
set the locH of sprite btnOutlineSprite = -1000
end Unhilite
on IfOnMac MacFrame, PCFrame
global gPlatform, gNavObj
if gPlatform = #PC then
set theSceneNum = value(PCFrame)
else
set theSceneNum = value(MacFrame)
end if
LoadSeq gNavObj, theSceneNum
ChangeScene gNavObj, theSceneNum
end CheckIfOnMac
on AddScrollingText me, textChannel, caller
if voidP(caller) or caller = 0 then
set textChannel = 0
end if
set ScrollingTextObj = birth(script "Scrolling Text Object", textChannel)
Add exitQue, "KillScrollingText me"
end AddScrollingText
on KillScrollingText me
if objectP(ScrollingTextObj) then
kill(ScrollingTextObj)
set scrollingTextObj = ""
end if
end KillScrollingText
on AddFinderObj me, whichFinder, caller
if voidP(caller) or caller = 0 then
alert "No type given for Finder Object! (should be #ATP or #MAGIC)"
else
set FinderObj = birth(script "Finder Object", whichFinder)
Add exitQue, "KillFinder me"
end if
end AddScrollingText
on KillFinder me
if objectP(FinderObj) then
kill(FinderObj)
set FinderObj = ""
end if
end KillFinder